package com.yanggeng.demo.beginnerguidedemo.utils;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

/**
 * Created by yanggeng on 2017/6/30.
 */

public class ToastUtil {

    /**
     * 居中显示的toast
     * @param context
     * @param text
     */
    public static void centerToast(Context context, String text) {
        Toast toast = Toast.makeText(context.getApplicationContext(), text, Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.show();
    }
}
